<template>
	<view class="container">
		<uni-list>
			<uni-list-item v-for="item,index in List" :key="index" :title="item.name" :note="item.lastMsg"
				clickable="true" :to="'../chat/chat?id='+item.id" thumbSize="lg" :rightText="item.time"
				:clickable="true" :showArrow="true">
				<template v-slot:header>
					<view class="round">
						<image :src="'/static/'+item.icon" mode="aspectFill"></image>
					</view>
				</template>
				<template v-slot:footer>
					<uni-badge :text="item.unread" type="error" v-if="item.unread"></uni-badge>
				</template>
			</uni-list-item>
		</uni-list>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				List: [{
						id: 1,
						name: '张三',
						lastMsg: '信息工程学院',
						icon: 'head_icon.png',
						time: '12:30',
						unread: 2
					},
					{
						id: 2,
						name: '李四',
						lastMsg: '信息工程学院',
						icon: 'logo.png',
						time: '昨天',
						unread: 12
					}
				]
			}
		}
	}
</script>

<style>
	.round{
		width: 80rpx;
		height: 80rpx;
		border-radius: 50%;
		overflow: hidden;
		margin-right: 15rpx;
	}

	.round image {
		width: 100%;
		height: 100%;
	}
</style>